extends Area2D
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
signal switch_map(position: int)

func setImage(path: String, name: String) -> void:
	var sprite_frames = load(path)
	animated_sprite_2d.sprite_frames = sprite_frames
	animated_sprite_2d.play(name)
	var my_image = animated_sprite_2d.sprite_frames.get_frame_texture(name, 0).get_image()
	var aaa = RectangleShape2D.new()
	aaa.size=Vector2(my_image.get_width(), my_image.get_height())
	collision_shape_2d.shape=aaa

func _on_body_entered(body: Node2D) -> void:
	emit_signal("switch_map",1)
